package com.liyue.animationutils;

import android.animation.ValueAnimator;
import android.view.View;

/**
 *  通过属性动画实现了控件的宽高改变
 */
public class Animator {

    private void createDropAnimator(final View v, int start, int end) {
        ValueAnimator animator = ValueAnimator.ofInt(start, end);
        animator.setRepeatMode(ValueAnimator.REVERSE);
        animator.setDuration(1000);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator arg0) {
                v.getLayoutParams().height = (Integer) arg0.getAnimatedValue();
                v.requestLayout();
//                wm.updateViewLayout(rootview, mParms);
            }

        });
        animator.addListener(new android.animation.Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(android.animation.Animator animation) {
            }
            @Override
            public void onAnimationEnd(android.animation.Animator animation) {
            }
            @Override
            public void onAnimationCancel(android.animation.Animator animation) {
            }
            @Override
            public void onAnimationRepeat(android.animation.Animator animation) {
            }
        });
        animator.start();
    }
}
